package com.ruoyi.statisticalCenter.service.impl;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.GetDateStringUtils;
import com.ruoyi.logistic.domain.NetworkName;
import com.ruoyi.logistic.mapper.NetworkNameMapper;
import com.ruoyi.statisticalCenter.domain.vo.ScContractAreaRemittanceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.statisticalCenter.mapper.ScContractAreaRemittanceMapper;
import com.ruoyi.statisticalCenter.domain.ScContractAreaRemittance;
import com.ruoyi.statisticalCenter.service.IScContractAreaRemittanceService;
import com.ruoyi.common.core.text.Convert;

/**
 * 承包区汇款Service业务层处理
 *
 * @author pyx
 * @date 2024-03-01
 */
@Service
public class ScContractAreaRemittanceServiceImpl implements IScContractAreaRemittanceService {
    @Autowired
    private ScContractAreaRemittanceMapper scContractAreaRemittanceMapper;
    @Autowired
    private NetworkNameMapper networkNameMapper;

    /**
     * 查询承包区汇款
     *
     * @param id 承包区汇款主键
     * @return 承包区汇款
     */
    @Override
    public ScContractAreaRemittance selectScContractAreaRemittanceById(Long id) {
        return scContractAreaRemittanceMapper.selectScContractAreaRemittanceById(id);
    }

    /**
     * 查询承包区汇款列表
     *
     * @param scContractAreaRemittanceVo 承包区汇款
     * @return 承包区汇款
     */
    @Override
    public List<ScContractAreaRemittance> selectScContractAreaRemittanceList(ScContractAreaRemittanceVo scContractAreaRemittanceVo) {
        //列表添加分页
        PageHelper.startPage(scContractAreaRemittanceVo.getPageDate());
        return scContractAreaRemittanceMapper.selectScContractAreaRemittanceList(scContractAreaRemittanceVo);
    }

    @Override
    public R cache(String time) {
//        List<String> times = GetDateStringUtils.generateDatesForMonth(2024, 5);
//        List<NetworkName> networkNames = networkNameMapper.selectAll();
//        for (NetworkName networkName : networkNames) {
//            ScContractAreaRemittanceVo scContractAreaRemittanceVo = new ScContractAreaRemittanceVo();
//            scContractAreaRemittanceVo.setContractAreaName(networkName.getNetworkName());
//
//        }
        return null;
    }

    /**
     * 新增承包区汇款
     *
     * @param scContractAreaRemittance 承包区汇款
     * @return 结果
     */
    @Override
    public R insertScContractAreaRemittance(ScContractAreaRemittance scContractAreaRemittance) {
        return scContractAreaRemittanceMapper.insertScContractAreaRemittance(scContractAreaRemittance) > 0 ? R.ok("新增成功") : R.fail("新增失败");
    }

    /**
     * 修改承包区汇款
     *
     * @param scContractAreaRemittance 承包区汇款
     * @return 结果
     */
    @Override
    public int updateScContractAreaRemittance(ScContractAreaRemittance scContractAreaRemittance) {
        return scContractAreaRemittanceMapper.updateScContractAreaRemittance(scContractAreaRemittance);
    }

    /**
     * 批量删除承包区汇款
     *
     * @param ids 需要删除的承包区汇款主键
     * @return 结果
     */
    @Override
    public int deleteScContractAreaRemittanceByIds(String ids) {
        return scContractAreaRemittanceMapper.deleteScContractAreaRemittanceByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除承包区汇款信息
     *
     * @param id 承包区汇款主键
     * @return 结果
     */
    @Override
    public int deleteScContractAreaRemittanceById(Long id) {
        return scContractAreaRemittanceMapper.deleteScContractAreaRemittanceById(id);
    }
}
